﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace Group_Mail
{
    public partial class frmImportRecipients : Form
    {
        public frmImportRecipients()
        {
            InitializeComponent();
        }

        public IList<string> Recipients { get; private set; }

        private void btnImport_Click(object sender, EventArgs e)
        {
            var lines = Regex.Split(txtRecipients.Text, "\r\n");
            Recipients = new List<string>();
            foreach (var line in lines)
            {
                var email = line.Trim();
                if (Utils.IsValidEmail(email))
                {
                    Recipients.Add(email);
                }
            }

            DialogResult = DialogResult.OK;
            Close();
        }
    }
}